function decodeVars(url, multi) {
  var vars = {};
  (url || '')
    .replace(/^([^?]*\?)?/, '')
    .replace(/\+/g, '%20').split('&').forEach(function (pair) {
    pair = pair.split('=').map(decodeURIComponent);
    var key = pair[0];
    var val = pair[1];
    if (multi) {
      if (!vars[key]) vars[key] = [];
      vars[key].push(val);
    }
    else
      vars[key] = val;
  });
  return vars;
}
